<!DOCTYPE HTML>
<html>
<head>

<meta charset="utf-8">
<load href='__PUBLIC__/css/H-ui.min.css' />
<load href='__PUBLIC__/css/H-ui.login.css' />     
<load href='__PUBLIC__/css/style.css' />     
<load href='__PUBLIC__/lib/Hui-iconfont/1.0.1/iconfont.css' />
<load href='__PUBLIC__/js/jquery-1.7.2.min.js' /> 


<title>后台登录</title>

</head>
<body>

<div class="header"></div>
<div class="loginWraper">
  <div id="loginform" class="loginBox">

    <form class="form form-horizontal"  method="post">

      <div class="row cl">
        <label class="form-label col-3"><i class="Hui-iconfont">&#xe60d;</i></label>
        <div class="formControls col-8">
          <input id="name" name="username" type="text" placeholder="账户" class="input-text size-L"><span id="ti"></span>
        </div>
      </div>

      <div class="row cl">
        <label class="form-label col-3"><i class="Hui-iconfont">&#xe60e;</i></label>
        <div class="formControls col-8">
          <input id="pass" name="pass" type="password" placeholder="密码" class="input-text size-L"><span id="pi"></span>
        </div>
      </div>

      <div class="row cl">
        <div class="formControls col-8 col-offset-3">
          <input  id="yzm" class="input-text size-L" name='yzm' type="text" placeholder="验证码" onblur="if(this.value==''){this.value='验证码:'}" onclick="if(this.value=='验证码:'){this.value='';}" value="验证码:" style="width:150px;">
          <img src="{:U('yzm')}" id="kanbuq"><a href="JavaScript:change()">换一张</a> </div>
      </div><span id="qi"></span>

    </form>
     <div class="row">
        <div class="formControls col-8 col-offset-3">
          <button name=""  type="submit" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;" id="submit">登陆</button>
          <input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
        </div>
      </div>
  </div>
</div>
<div class="footer">Copyright 你的公司名称 by H-ui.admin.v2.3</div>

</body>
</html>
<script>

  function change(){
    var img = document.getElementById('kanbuq');
    img.src=img.src+"?";
  }


  $('#name').blur(function(){
     var name=$.trim($("#name").val());
     if(name==""){
      $('#ti').text('用户名不能为空!').css({'color':'red','font-size':'14px'});
    }else{
      $('#ti').text('输入成功!').css({'color':'green','font-size':'14px'});
    } 
  })
  $('#pass').blur(function(){
  var pass=$.trim($("#pass").val());
    if(pass==""){
      $('#pi').text('密码不能为空!').css({'color':'red','font-size':'14px'});
    }else{
      $('#pi').text('输入成功!').css({'color':'green','font-size':'14px'});
    }
  })
    $('#yzm').blur(function(){
  var code=$.trim($("#yzm").val());
    if(code==""){
      $('#qi').text('验证码不能为空！').css({'color':'red','font-size':'14px'});
    }else{
      $('#qi').text('');
    }
  })
  $('#submit').click(function(){

    $.post('{:U('aja')}',{name:$('#name').val(),pass:$('#pass').val(),yzm:$('#yzm').val()},function(obj){
      //console.log(obj);
      if(obj[3]=='a'){
        $('#qi').text('验证码错误!').css({'color':'red','font-size':'14px'});
        return false;
      }
      if(obj[1]=='b'){
        $('#ti').text('用户名错误!').css({'color':'red','font-size':'14px'});
        return false;
      }
      if(obj[2]=='c'){
        $('#pi').text('密码错误!').css({'color':'red','font-size':'14px'});
        return false;
      }
      window.location = "{:U('Admin/Index/index')}";
    })
  })
  
</script>


